<?php
$this->pageTitle=Yii::app()->name . ' - Погашение рассрочки';
$this->breadcrumbs=array(
	'Поиск'=>Yii::app()->createUrl('clients/search'),
	'Карточка клиента'=>Yii::app()->createUrl('clients/view',array('id'=>$credit->client_id)),
	'Договор рассрочки'=>Yii::app()->createUrl('credits/view',array('id'=>$credit->id)),
	'Погашение рассрочки'
);
?>

<fieldset>
	<legend>Погашение рассрочки</legend>
	<div id="client-card-block">
		<dl class="dl-horizontal">
			<dt>Клиент</dt>
			<dd><?=$credit->client->surname?> <?=$credit->client->name?> <?=$credit->client->patronymic?></dd>

			<dt><?=$credit->getAttributeLabel('id')?></dt>
			<dd><?=$credit->id?></dd>

			<dt><?=$credit->getAttributeLabel('product_name')?></dt>
			<dd><?=$credit->product_name?></dd>

			<dt><?=$credit->getAttributeLabel('sum')?></dt>
			<dd><?=$credit->sum?> руб.</dd>

			<dt>Выплачено</dt>
			<dd><?=$credit->repaymentsSum?> руб.</dd>

			<dt>Осталось выплатить</dt>
			<dd><?=$credit->sum - $credit->repaymentsSum?> руб.</dd>

			<dt>Осталось (дней)</dt>
			<dd><?=$credit->getEndDays()?:'<span class="label label-important">Просрочен</span>'?></dd>
		</dl>
	</div>
</fieldset>

<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'repayment-form',
	'type'=>'horizontal',
	'enableAjaxValidation'=>true,
	'clientOptions' => array(
		'validateOnSubmit' => true,
	),
)); ?>

<?php echo $form->textFieldRow($repayment, 'sum', array('class'=>'input-block-level')); ?>

<div class="form-actions">
	<?php $this->widget('bootstrap.widgets.TbButton', array(
		'buttonType'=>'submit',
		'type'=>'success',
		'label'=>'Внести сумму',
	)); ?>
</div>

<?php $this->endWidget(); ?>
